/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.cggveritas.crewintranet.jms.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Alassane
 */
@Entity
@Table(name = "cv_historiqueaffectation")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CvHistoriqueaffectation.findAll", query = "SELECT c FROM CvHistoriqueaffectation c"),
    @NamedQuery(name = "CvHistoriqueaffectation.findByIdhistoriqueaffectation", query = "SELECT c FROM CvHistoriqueaffectation c WHERE c.idhistoriqueaffectation = :idhistoriqueaffectation"),
    @NamedQuery(name = "CvHistoriqueaffectation.findByDepartement", query = "SELECT c FROM CvHistoriqueaffectation c WHERE c.departement = :departement"),
    @NamedQuery(name = "CvHistoriqueaffectation.findByEquipe", query = "SELECT c FROM CvHistoriqueaffectation c WHERE c.equipe = :equipe"),
    @NamedQuery(name = "CvHistoriqueaffectation.findByPoste", query = "SELECT c FROM CvHistoriqueaffectation c WHERE c.poste = :poste"),
    @NamedQuery(name = "CvHistoriqueaffectation.findByDatedebut", query = "SELECT c FROM CvHistoriqueaffectation c WHERE c.datedebut = :datedebut"),
    @NamedQuery(name = "CvHistoriqueaffectation.findByDatefin", query = "SELECT c FROM CvHistoriqueaffectation c WHERE c.datefin = :datefin")})
public class CvHistoriqueaffectation implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Basic(optional = false)
    @Column(name = "idhistoriqueaffectation")
    private Integer idhistoriqueaffectation;
    @Column(name = "departement")
    private String departement;
    @Column(name = "equipe")
    private String equipe;
    @Column(name = "poste")
    private String poste;
    @Column(name = "datedebut")
    @Temporal(TemporalType.DATE)
    private Date datedebut;
    @Column(name = "datefin")
    @Temporal(TemporalType.DATE)
    private Date datefin;
    @JoinColumn(name = "cv_travailleur_id", referencedColumnName = "id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private CvTravailleur cvTravailleurId;

    public CvHistoriqueaffectation() {
    }

    public CvHistoriqueaffectation(Integer idhistoriqueaffectation) {
        this.idhistoriqueaffectation = idhistoriqueaffectation;
    }

    public Integer getIdhistoriqueaffectation() {
        return idhistoriqueaffectation;
    }

    public void setIdhistoriqueaffectation(Integer idhistoriqueaffectation) {
        this.idhistoriqueaffectation = idhistoriqueaffectation;
    }

    public String getDepartement() {
        return departement;
    }

    public void setDepartement(String departement) {
        this.departement = departement;
    }

    public String getEquipe() {
        return equipe;
    }

    public void setEquipe(String equipe) {
        this.equipe = equipe;
    }

    public String getPoste() {
        return poste;
    }

    public void setPoste(String poste) {
        this.poste = poste;
    }

    public Date getDatedebut() {
        return datedebut;
    }

    public void setDatedebut(Date datedebut) {
        this.datedebut = datedebut;
    }

    public Date getDatefin() {
        return datefin;
    }

    public void setDatefin(Date datefin) {
        this.datefin = datefin;
    }

    public CvTravailleur getCvTravailleurId() {
        return cvTravailleurId;
    }

    public void setCvTravailleurId(CvTravailleur cvTravailleurId) {
        this.cvTravailleurId = cvTravailleurId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idhistoriqueaffectation != null ? idhistoriqueaffectation.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CvHistoriqueaffectation)) {
            return false;
        }
        CvHistoriqueaffectation other = (CvHistoriqueaffectation) object;
        if ((this.idhistoriqueaffectation == null && other.idhistoriqueaffectation != null) || (this.idhistoriqueaffectation != null && !this.idhistoriqueaffectation.equals(other.idhistoriqueaffectation))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fr.cggveritas.crewintranet.jms.entities.CvHistoriqueaffectation[ idhistoriqueaffectation=" + idhistoriqueaffectation + " ]";
    }
    
}
